home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 85 / CD Temático 40 Febrero 2004.iso / DOS / testdisk / src / bfs.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-01-09  |  3.1 KB  |  81 lines

  1. /*
  2.  
  3.     File: bfs.h
  4.  
  5.     Copyright (C) 1998-2004 Christophe GRENIER <grenier@cgsecurity.org>
  6.   
  7.     This software is free software; you can redistribute it and/or modify
  8.     it under the terms of the GNU General Public License as published by
  9.     the Free Software Foundation; either version 2 of the License, or
  10.     (at your option) any later version.
  11.   
  12.     This program is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.     GNU General Public License for more details.
  16.   
  17.     You should have received a copy of the GNU General Public License
  18.     along with this program; if not, write to the Free Software
  19.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21.  */
  22.  
  23. typedef struct block_run
  24. {
  25.     int32   allocation_group;
  26.     uint16  start;
  27.     uint16  len;       /* in blocks */
  28. } block_run;
  29.  
  30. typedef block_run inode_addr;
  31.  
  32.  
  33. #define B_OS_NAME_LENGTH 32
  34.  
  35. typedef struct disk_super_block          /* super block as it is on disk */
  36. {
  37.     char         name[B_OS_NAME_LENGTH];
  38.     int32        magic1;                /* 0x20 */
  39.     int32        fs_byte_order;         /* 0x24 */
  40.  
  41.     uint32       block_size;            /* 0x28 in bytes */
  42.     uint32       block_shift;           /* 0x2C block_size == (1 << block_shift) */
  43.  
  44.     int64        num_blocks;            /* 0x30 */
  45.     int64        used_blocks;           /* 0x38 */
  46.  
  47.     int32        inode_size;            /* 0x40 # of bytes per inode */
  48.  
  49.     int32        magic2;                /* 0x44 */
  50.     int32        blocks_per_ag;         /* 0x48 in blocks */
  51.     int32        ag_shift;              /* 0x4C # of bits to shift to get ag num */
  52.     int32        num_ags;               /* 0x50 # of allocation groups */
  53.     int32        flags;                 /* 0x54 if it's clean, etc */
  54.     block_run    log_blocks;             /* 0x58 a block_run of the log blocks */
  55.     int64        log_start;              /* 0x60 block # of the beginning */
  56.     int64        log_end;                /* 0x68 block # of the end of the log */
  57.  
  58.     int32        magic3;                /* 0x70 */
  59.     inode_addr   root_dir;              /* 0x74 */
  60.     inode_addr   indices;               /* 0x7C */
  61.  
  62.     int32        pad[8];                /* 0x84 extra stuff for the future */
  63.                     /* 0xA4-0xFF */
  64. } disk_super_block;
  65.  
  66.  
  67. /*the flags field can have these values */
  68. #define BFS_CLEAN   0x434c454e           /* 'CLEN', for flags field */
  69. #define BFS_DIRTY   0x44495254           /* 'DIRT', for flags field */
  70.  
  71. /* these are the magic numbers for the 3 magic fields */
  72. #define SUPER_BLOCK_MAGIC1   0x42465331    /* BFS1 */
  73. #define SUPER_BLOCK_MAGIC2   0xdd121031
  74. #define SUPER_BLOCK_MAGIC3   0x15b6830e
  75.  
  76. /* this is stored in the fs_byte_order field... it's kind of dumb */
  77. #define BFS_BIG_ENDIAN       0x42494745    /* BIGE */
  78. /* int test_beos(struct disk_super_block *,t_diskext); */
  79. int check_BeFS(t_param_disk *disk_car,t_diskext *partition,const int debug);
  80. int recover_BeFS(t_param_disk *disk_car, const struct disk_super_block *beos_block,t_diskext *partition,const int debug, const int dump_ind);
  81.